//
//  ZM_Banner_CVCell.m
//  YYFMMall
//
//  Created by MAC on 2019/12/20.
//  Copyright © 2019 YuYou1. All rights reserved.
//

#import "ZM_Banner_CVCell.h"

@interface ZM_Banner_CVCell()<SDCycleScrollViewDelegate>


@end

@implementation ZM_Banner_CVCell
#pragma mark - 赋值


#pragma mark -Methods
- (void)setImgArr:(NSArray *)imgArr{
    _imgArr = imgArr;
    self.cycleScrollView.imageURLStringsGroup = imgArr;
}

#pragma mark - Intial
-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder: aDecoder]) {
        [self setUpBaseData];
        [self setUpUI];
    }
    return self;
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setUpBaseData];
        [self setUpUI];
    }
    return self;
}

///基本数据配置
-(void)setUpBaseData{
    
}

///控件添加
-(void)setUpUI{
    
}


-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    !self.cycleScrollViewSelectBlock?:self.cycleScrollViewSelectBlock(index);
}

#pragma mark - 布局
-(void)layoutSubviews{
    [super layoutSubviews];
    
}

#pragma mark - lazyload
-(SDCycleScrollView *)cycleScrollView{
    if (!_cycleScrollView) {
        _cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:kImage(KDefBannerIcon)];
        _cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleToFill;
        _cycleScrollView.currentPageDotColor = kMainColor;
        _cycleScrollView.pageDotColor = kBgColor;
        _cycleScrollView.showPageControl = YES;
        _cycleScrollView.delegate = self;
        _cycleScrollView.hidesForSinglePage = YES;
        _cycleScrollView.autoScroll = YES;
        _cycleScrollView.infiniteLoop = YES;
        _cycleScrollView.backgroundColor = kHexColor(0xF6F6F6);
        [self addSubview:_cycleScrollView];
        [_cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.mas_equalTo(0);
        }];
    }
    return _cycleScrollView;
}


-(void)dealloc{
    
}
@end
